package com.zxy.fmmall.controller;

import com.zxy.fmmall.service.CategoryService;
import com.zxy.fmmall.service.IndexImgService;
import com.zxy.fmmall.service.ProductCommentService;
import com.zxy.fmmall.service.ProductService;
import com.zxy.fmmall.vo.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("index")
@CrossOrigin
@Api(value = "提供首页接口",tags = "首页管理")
public class IndexImgController {
    @Autowired
    private IndexImgService indexImgService;
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private ProductService productService;

    @GetMapping("/indeximg")
    @ApiOperation("首页轮播图接口")
    public ResultVo listIndexImgs(){
        return indexImgService.listIndexImgs();
    }

    @GetMapping("/category-list")
    @ApiOperation("商品分类查询接口")
    public ResultVo selectAllCategories() {
        return categoryService.selectAllCategories();
    }


    @GetMapping("/list-recommends")
    @ApiOperation("查询推荐商品接口")
    public ResultVo selectRecommendProducts(){
       return productService.selectRecommendProducts();
    }
    @GetMapping("/list-popularProduct")
    @ApiOperation("查询每一级中热门商品接口")
    public ResultVo selectFirstLevelCategories(){
        return categoryService.selectFirstLevelCategories();
    }



}
